﻿using System;
using System.Collections.Generic;
using System.DirectoryServices;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;
using System.Threading.Tasks;

using Magicodes.ExporterAndImporter.Excel.AspNetCore;

using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using NP.BPMReportPlatform.DBHelper;
using NP.BPMReportPlatform.ElectronicSign;
using NP.BPMReportPlatform.Entities.BPM_Business.Resume;
using NP.BPMReportPlatform.Entities.BPM_Platform;
using NP.BPMReportPlatform.RecurringJobs;
using NP.BPMReportPlatform.RecurringJobs.Dto;
using NP.BPMReportPlatform.Resume.Dtos;
using NP.BPMReportPlatform.Samples.Dtos;
using NP.BPMReportPlatform.TalentProfile;
using SqlSugar;
using Volo.Abp;
using Volo.Abp.Application.Dtos;

namespace NP.BPMReportPlatform.Resume
{
    //[Authorize]
    [Route("api/resume")]
    public class ResumeController : BPMReportPlatformController
    {
        private readonly IResumeService _resumeService;
        public ResumeController(IResumeService resumeService)
        {
            _resumeService = resumeService;
        }

        /// <summary>
        /// 从ftp同步文件
        /// </summary>
        /// <param name="filePath">文件路径</param>
        /// <returns></returns>
        [HttpGet]
        [Route("SyncResumeFiles")]
        public async Task SyncResumeFiles(string filePath)
        {
            await _resumeService.SyncResumeFiles(filePath);
        }

        /// <summary>
        /// 获取OSS下载链接
        /// </summary>
        /// <param name="id">id</param>
        /// <param name="type">附件序号</param>
        /// <returns></returns>
        [HttpGet]
        [Route("GetDownloadUri/{id}/{type}")]
        public string GetDownloadUri([FromRoute] string id, [FromRoute] int type)
        {
            return _resumeService.GetDownloadUri(id, type);
        }

        /// <summary>
        /// 查询简历明细
        /// </summary>
        /// <param name="input"></param>
        /// <returns>简历明细列表</returns>
        [HttpPost]
        [Route("OSS/GetResumeInfoListResult")]
        public async Task<PagedResultDto<ResumeInfoEntity>> GetResumeInfoListResult([FromBody] GetResumeInfoInput input)
        {
            return await _resumeService.GetResumeInfoListResult(input);
        }
    }
}
